package DBtools;

import java.util.List;

import model.transfermodel.PersonPackage;
import model.transfermodel.SMSPackage;

public class ContractBO extends BaseDao {
	private String SQLInsert = "INSERT INTO contract(imei, name, phone, email, address , c_id) VALUES (? , ? , ?, ?, ?, ?)";
	private String SQLQueryAll   = "Select * from contract";
	private String SQLQuery   = "Select * from contract where imei = ?";
	
	public List find(String imei){
		Object[] objects = new Object[1];
		int[] types   = new int[1];
		
		objects[0] = imei;
		types[0]   = java.sql.Types.VARCHAR;
		
		return executeQuery(SQLQuery, objects, types);
	}
	
	public void insertContract(PersonPackage pack){
		
		Object[] objects = new Object[6];
		int[] types   = new int[6];
		
		objects[0] = pack.imei;
		types[0] = java.sql.Types.VARCHAR;
		
		objects[1] = pack.name;
		types[1] = java.sql.Types.VARCHAR;
		
		objects[2] = pack.phone;
		types[2] = java.sql.Types.VARCHAR;
		
		objects[3] = pack.email;
		types[3] = java.sql.Types.VARCHAR;
		
		objects[4] = pack.address;
		types[4] = java.sql.Types.VARCHAR;
		
		objects[5] = pack.id;
		types[5] = java.sql.Types.VARCHAR;
		
		executeUpdate(SQLInsert, objects, types);
	}
	
	
	public static void  main(String[] args){
		PersonPackage pack = new PersonPackage();
		pack.imei = "imei";
		pack.phone="xxxxxxxxxxx";
		pack.address="yyyyyyyyyyyy";
		
		ContractBO bo = new ContractBO();
		bo.insertContract(pack);
		
	}
}
